<?php
/**
 * Created by PhpStorm.
 * User: fangwei
 * Date: 2019-08-20
 * Time: 15:58
 */

namespace App\Http\Requests\Admin;


use Illuminate\Foundation\Http\FormRequest;

class CategoryInputDTO extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        $id = $this->route('id');
        return [
            'title' => 'required|max:20|unique:categories,id,'.$id,
            'rank' => 'integer|max:10',
            
        ];
    }

    public function messages()
    {
        return [
            'title.required' => '分别名称必须填写',
            'title.max' => '分类名称不能超过20个字符',
            'title.unique' => '分类名称重复',
            'rank.integer' => '排序必须填写数字',
            'rank.max' => '排序值需小于10',
        ];
    }
}